package cn.mw.cmdb.entity;

import cn.mw.components.mongodb.anno.CMDBProperty;
import cn.mw.components.mongodb.anno.CMDBRelations;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
import org.springframework.data.mongodb.core.mapping.Document;

import java.util.List;
import java.util.Map;

@Data
@Document("mw_cmdbmd_instance")
public class InstanceGroupByPathAndStatus {

    @Schema(description = "实例Id")
    @CMDBProperty
    private String _id;

    @Schema(description = "实例Id")
    private String instanceId;
    @CMDBProperty
    private List<String> path;

    @CMDBProperty
    private String modelId;

    @CMDBRelations(targetClass = ModelInfo.class, targetField = "modelType", localField = "modelId", foreignField = "_id", isNeedUnwind = false)
    private String modelType;

    @CMDBProperty
    private String groupId;

    @CMDBProperty
    private String itemAssetsStatus;

    @CMDBProperty
    private String financeParentId;

    @CMDBProperty
    private Map data;

    //所属用户组
    @CMDBProperty(searchType = PropertyTypeGroup.ID)
    private List<Long> groups;

    //所属用户
    @CMDBProperty(searchType = PropertyTypeList.ID)
    private List<Long> users;

    //所属机构id
    //便于数据权限查询时,只查询自己机构的数据
    @CMDBProperty(searchType = PropertyTypeOrg.ID)
    private List<Long> orgIds;

    @CMDBProperty(searchType = PropertyTypeOrg.ID)
    private List<List<Long>> orgs;

    @CMDBProperty(logicDel = true)
    protected Boolean delFlag = false;
    private int count;
}
